<?php

/**
 * Created by PhpStorm.
 * User: fenfen
 * Date: 2016/10/17
 * Time: 18:30
 */
namespace backend\controllers;

use bc\controller\BackendController;
use bc\model\ScanqrcModel;
use bc\util\backend\Page;

class ScanqrcController extends BackendController
{
	/**
	 * 我的个人推广
	 */
	public function actionIndex()
	{
		$openid=$_REQUEST['openid'];
		$nickname=$_REQUEST['nickname'];
		$where = array (
			'myopenid' => $openid,
			'status' => 1
		);

		$page = $this->get('page', 1);

		$scanqrcM = new ScanqrcModel();
		$scanqrcM->columns = 'id,nickname,create_time,headimgurl';
		$scanqrcM->sort = 'id desc';
		$ScanqrcList = $scanqrcM->getList( $where,$page,self::PAGE_SIZE);
		$total = $scanqrcM->getTotal($where);
		$pagination = new Page($total, self::PAGE_SIZE);
		$row['pagination'] = $pagination;
		$row['nickname'] = $nickname;
		$row ['ScanqrcList'] = $ScanqrcList;
		return $this->render('index',$row);

	}
}
